import { getCategoryApi } from '../../../../api/nav.js';

Component({
  behaviors: [],
  properties: {},
  data: {
    navList: [],
  },
  lifetimes: {
    async created() {
      const data = await getCategoryApi();
      console.log('🚀 ~ created ~ data ====> ', data);
      this.setData({
        navList: data,
      });
    },
    attached() {},
    moved() {},
    detached() {},
  },
  methods: {
    handleToCategoryPage(e) {
      console.log(e.currentTarget.dataset.id);
      const cateId = e.currentTarget.dataset.id;
      wx.reLaunch({
        url: `/pages/category/category?id=${cateId}`,
      });
    },
  },
});
